﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Admx_Generator
{
    public class SupportedOnItem:IEquatable<SupportedOnItem>
    {
        private string _nameAttribute = string.Empty;
        private string _displayNameAttribute = string.Empty;
        private string _localizedDisplayName = string.Empty;

        public SupportedOnItem(Namespace itemNamespace)
        {
            this.Namespace = itemNamespace;
        }

        /// <summary>
        /// Namespace where this SupportedOn Item is include.
        /// </summary>
        public Namespace Namespace { get; set; }

        /// <summary>
        /// Name of this SupportedOn Item. It will be use in the SupportedOn Element.
        /// </summary>
        public string NameAttribute { get { return this._nameAttribute; } set { this._nameAttribute = value; } }

        /// <summary>
        /// Display Name Attribute. it will be use to search in hte ADML file.
        /// </summary>
        private string DisplayNameAttribute { get { return this._displayNameAttribute; } set { this._displayNameAttribute = value; } }

        /// <summary>
        /// The localized text corresponding to the DisplayName Attribute.
        /// </summary>
        internal string LocalizedDisplayName { get { return this._localizedDisplayName; } set { this._localizedDisplayName = value; } }

        public Reference Reference
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }

        public override string ToString()
        {
            return this.LocalizedDisplayName;
        }

        public bool Equals(SupportedOnItem other)
        {
            if (other == null)
                return false;
            return (this.Namespace.Equals(other.Namespace) && String.Compare(this.NameAttribute, other.NameAttribute, StringComparison.InvariantCultureIgnoreCase) == 0);
        }

        public override bool Equals(object obj)
        {
            return Equals(obj as SupportedOnItem);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
